﻿using ADX.Views;
using Base.BLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;

namespace MPSystem.Views.YFQ
{
    /// <summary>
    /// DP_test_Condition3.xaml 综采数据查询--查询条件
    /// </summary>
    public partial class DataQuery_ZCMRGZZL_Conditon : Page
    {
        public Dictionary<string, string> Cond = new Dictionary<string, string>();
        public static DataQuery_ZCMRGZZL_Conditon _Me = null;
        public static DataQuery_ZCMRGZZL_Conditon Me
        {
            get
            {
                if (_Me == null)
                {
                    _Me = new DataQuery_ZCMRGZZL_Conditon();
                    _Me.UpdateCond();
                }
                return _Me;
            }
            set { _Me = value; }
        }
        int gzmbh = 0;

        public DataQuery_ZCMRGZZL_Conditon()
        {
            InitializeComponent();
            LoadData();
            Me = this;
        }

        public void LoadData()
        {
            #region 加载单位选择
            string strP = "MPa,KN";
            string[] arP = strP.Split(',');
            foreach (var ar in arP)
            {
                CB_DW.Items.Add(ar);
            }
            CB_DW.SelectedIndex = 0;
            #endregion

            BegTime.SelectedDate = DateTime.Now;
            EndTime.SelectedDate = DateTime.Now;
        }
        
        public void UpdateCond()
        {
            Cond.Clear();
            try
            {
                Cond.Add("dtStart", BegTime.Text);
                Cond.Add("dtEnd", EndTime.Text);
                Cond.Add("MPa", CB_DW.SelectedValue.ToString());
            }
            catch { }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.CloseParentWindow();

        }
        #region 多选下拉框使用
        public event PropertyChangedEventHandler PropertyChanged;
        protected void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        private Dictionary<string, object> _items;
        private Dictionary<string, object> _selectedItems;
        public Dictionary<string, object> Items
        {
            get
            {
                return _items;
            }
            set
            {
                _items = value;
                NotifyPropertyChanged("Items");
            }
        }
        public Dictionary<string, object> SelectedItems
        {
            get
            {
                return _selectedItems;
            }
            set
            {
                _selectedItems = value;
                NotifyPropertyChanged("SelectedItems");
            }
        }
        private void Submit()
        {
            foreach (KeyValuePair<string, object> s in SelectedItems)
                MessageBox.Show(s.Key);
        }
        #endregion
    }
}
